package luogu.dfs;

import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2022/12/22 23:00
 */
public class StrangeElevator {
    static int a;
    static int n;
    static int b;
    //    static int sum=0;
    static int min;
    //    static int count=0;
//    static List<Integer> set=new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
//        StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));//快读
//        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));//快写
        n=sc.nextInt();
        a=sc.nextInt();
        b=sc.nextInt();
        int[]arr=new int[n+1];
        for (int i = 1; i <= n; i++) {
            arr[i]=sc.nextInt();
        }
        if(b>n){
            System.out.println(-1);
            return;
        }
        if(b<0){
            System.out.println(-1);
            return;
        }
        min=n+1;
        dfs(a,arr,0);
        if(min==n+1){
            System.out.println(-1);
            return;
        }
        System.out.println(min);

    }
    public static void dfs(int u,int[]arr,int count){
        if(min<=count){
            return;
        }
        if(u==b){
            min=count;
            return;
        }
        int x=u+arr[u];
        if(x<=n){
            dfs(x,arr,count+1);
        }
        x=u-arr[u];
        if(x>0){
            dfs(x,arr,count+1);
        }
    }
}
